<p>We’ve been using <code>() -&gt; Void</code> to mean “accepts no parameters and returns nothing”, but you can replace that <code>Void</code> with any type of data to force the closure to return a value.</p>
<p>To demonstrate this, we can write a <code>travel()</code> function that accepts a closure as its only parameter, and that closure in turn accepts a string and returns a string:</p>
<pre class="code">
<p></p>
<p><span class="keyword">func</span> <span class="function">travel</span><span class="punctuation">(</span>action<span class="punctuation">:</span> <span class="punctuation">(</span><span class="builtin">String</span><span class="punctuation">)</span> <span class="operator">-</span><span class="operator">&gt;</span> <span class="builtin">String</span><span class="punctuation">)</span> <span class="punctuation">{</span></p>
<p>  <span class="function">print</span><span class="punctuation">(</span><span class="string">"I'm getting ready to go."</span><span class="punctuation">)</span></p>
<p>  <span class="keyword">let</span> description <span class="operator">=</span> <span class="function">action</span><span class="punctuation">(</span><span class="string">"London"</span><span class="punctuation">)</span></p>
<p>  <span class="function">print</span><span class="punctuation">(</span>description<span class="punctuation">)</span></p>
<p>  <span class="function">print</span><span class="punctuation">(</span><span class="string">"I arrived!"</span><span class="punctuation">)</span></p>
<p><span class="punctuation">}</span></p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>
<p>Now when we call <code>travel()</code> using trailing closure syntax, our closure code is required to accept a string and return a string:</p>
<pre class="code">
<p></p>
<p>travel <span class="punctuation">{</span> <span class="punctuation">(</span>place<span class="punctuation">:</span> <span class="builtin">String</span><span class="punctuation">)</span> <span class="operator">-</span><span class="operator">&gt;</span> <span class="builtin">String</span> <span class="keyword">in</span></p>
<p>  <span class="keyword">return</span> <span class="string">"I'm going to <span class="interpolation"><span class="delimiter variable">\(</span>place<span class="delimiter variable">)</span></span> in my car"</span></p>
<p><span class="punctuation">}</span></p>
<p></p>
</pre>

<p style="height: 0px; margin-bottom: 0px;"></p>